import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:namewava/jc_root.dart';
import 'package:namewava/jc_rote_path.dart';
import 'package:namewava/pages/calendar/jc_calender_bwl.dart';
import 'package:namewava/pages/launch/jc_login_page.dart';
import 'package:namewava/pages/mine/jc_about.dart';
import 'package:namewava/pages/mine/jc_app_purchase.dart';
import 'package:namewava/pages/mine/jc_mine_info.dart';
import 'package:namewava/pages/mine/jc_set.dart';

final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

class JcTabbar extends StatefulWidget {
  const JcTabbar({super.key});

  @override
  State<JcTabbar> createState() => _JcTabbarState();
}

class _JcTabbarState extends State<JcTabbar> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
        designSize: const Size(375, 812),
        builder: (context, child) => GetMaterialApp(
              navigatorKey: navigatorKey,
              builder: EasyLoading.init(),
              debugShowCheckedModeBanner: false,
              getPages: appPages(),
              defaultTransition: Transition.rightToLeft,
              home: const JcRoot(),
            ));
  }

  List<GetPage> appPages() {
    List<GetPage> pages = [
      GetPage(name: JcRotePath.jcSet, page: (() => const JcSet())),
      GetPage(name: JcRotePath.jcAbout, page: (() => const JcAbout())),
      GetPage(name: JcRotePath.jcLogin, page: (() => const JcLoginPage())),
      GetPage(name: JcRotePath.jcBwl, page: (() => const JcCalenderBwl())),
      GetPage(name: JcRotePath.jcMineInfo, page: (() => const JcMineInfo())),
      GetPage(name: JcRotePath.jcPurchase, page: (() => const JcAppPurchase())),
    ];
    return pages;
  }
}
